package org.statewalker.validator;

/**
 * @author kotelnikov
 */
public abstract class ValidatorFactory {

    protected final ValidatorGrammar fGrammar = new ValidatorGrammar();

    public ValidatorFactory() {
        configureDictionaries();
        ValidatorGrammarConfig config = getConfigurator();
        configureTransitions(config);
    }

    protected abstract void configureDictionaries();

    protected abstract void configureTransitions(ValidatorGrammarConfig config);

    public ValidatorGrammarConfig getConfigurator() {
        ValidatorGrammarConfig config = new ValidatorGrammarConfig(fGrammar);
        return config;
    }

    public ValidatorGrammar getGrammar() {
        return fGrammar;
    }

    public Validator newValidator() {
        return new Validator(fGrammar);
    }

}
